/**
 * @author cheng on 2019-02-12.
 */
const common = {};

common.getNowStr = function () {
   let now = new Date();
   let year = now.getFullYear().toString();
   let month = (now.getMonth() + 1).toString();
   let day = now.getDate().toString();
   let hour = now.getHours().toString();
   let minute = now.getMinutes().toString();
   let seconds = now.getSeconds().toString();
   return year + month + day + hour + minute + seconds;
};

//生成唯一标识符
common.guid = function () {
   function S4() {
      return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
   }
   return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
};

export default common;


/*


 //第一种
 export function isWscnEmail(str) {
 const reg = /^[a-z0-9](?:[-_.+]?[a-z0-9]+)*@wallstreetcn\.com$/i;
 return reg.test(str.trim());
 }
 //validate文件名，isWscnEmail方法名
 //import { isWscnEmail } from "utils/validate";
 //使用   isWscnEmail()



 //第二种
 export default function isWscnEmail(str) {
 const reg = /^[a-z0-9](?:[-_.+]?[a-z0-9]+)*@wallstreetcn\.com$/i;
 return reg.test(str.trim());
 }
 //后一个openWindow文件名，前一个openWindow方法名，这种方式一个文件一种方法，文件名就是方法名
 //这种类似于本文使用的这种，把isWscnEmail方法抛出去，本文是把common这个对象抛出去
 //import openWindow from 'utils/openWindow';
 //使用  openWindow()



 */